from package.connector.elastic_db import es_db


class Audit:

    Index = 'system_audit_log'

    def get(self, body, page, page_size):
        return es_db.search_page_data(index=self.Index, body=body, page=page, page_size=page_size)

    def delete(self, ids):
        resp = es_db.delete(index=self.Index, body={'query': {'terms': {'_id': ids}}})
        return resp.get('deleted', 0)


class Event(Audit):
    Index = 'system_event_log'


audit = Audit()
event = Event()
